const setStorage=(key,value)=>{
    console.log(value instanceof Array)
    console.log(value instanceof Object)
    if(value instanceof Array || value instanceof Object){
        value = JSON.stringify(value);
    }
    localStorage.setItem(key,value);
}

const getStorage = (key)=>{
    var val = localStorage.getItem(key);
    var reg = /^[[{].*[\]}]$/
    if(reg.test(val)){
        val = JSON.parse(val);
    }
    return val;
}

export {
    setStorage,
    getStorage,
}